package it.heima.chy;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.List;
import java.util.ResourceBundle;

public class Test3 {
    public static void main(String[] args) throws DocumentException, FileNotFoundException {

        SAXReader saxReader = new SAXReader();

       // File file = new File("books.xml");
//        System.out.println(file.getAbsolutePath());
        Document document = saxReader.read("src\\books.xml");

        Element root = document.getRootElement();
        System.out.println(root.getName());
        List<Element> elements = root.elements();
        for (Element element : elements) {
            System.out.println(element.elementText("name"));
            System.out.println(element.elementText("house"));
            System.out.println(element.elementText("Date"));
            System.out.println(element.elementText("Price"));
        }


    }
}
